docs: modernize type annotations to Python 3.10+ built-in generics#5995
docs: modernize type annotations to Python 3.10+ built-in generics#5995FBISiri wants to merge 1 commit into
Conversation
Since crewAI requires Python >=3.10 (pyproject.toml), code examples in documentation should use modern built-in generic types instead of importing from typing: - List[X] → list[X] - Dict[K, V] → dict[K, V] - Tuple[X] → tuple[X] - Optional[X] → X | None - Union[X, Y] → X | Y This removes unnecessary typing imports and aligns documentation with PEP 585 (built-in generics) and PEP 604 (union type operator). Updated 9 documentation files across quickstart, guides, learn, and observability sections.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR modernizes Python type annotations across nine documentation guides to use Python 3.10+ syntax. Typing imports are removed, ChangesType Annotation Modernization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Since crewAI requires Python ≥3.10 (
pyproject.toml), code examples in documentation should use modern built-in generic types instead of importing fromtyping.Changes
Across 9 documentation files (quickstart, guides, learn, observability):
List[X]list[X]Dict[K, V]dict[K, V]Tuple[X]tuple[X]Optional[X]X | NoneUnion[X, Y]X | YThis removes unnecessary
from typing import ...lines and aligns documentation with:X | YFiles modified
docs/en/quickstart.mdxdocs/en/guides/crews/first-crew.mdxdocs/en/guides/flows/first-flow.mdxdocs/en/guides/flows/mastering-flow-state.mdxdocs/en/guides/concepts/evaluating-use-cases.mdxdocs/en/learn/conditional-tasks.mdxdocs/en/learn/custom-llm.mdxdocs/en/learn/bring-your-own-agent.mdxdocs/en/observability/braintrust.mdxWhy
New users copy-pasting from docs get cleaner, more modern Python code. The old
typingimports are unnecessary boilerplate since Python 3.10, which is crewAI's minimum supported version.Summary by CodeRabbit
typingmodule type hints with built-in generic types and union syntax for improved code clarity